| Total Complexity | 2 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import {writeFileSync} from 'fs' |
||
| 7 | |||
| 8 | class Elasticsearch extends Service { |
||
| 9 | requireRoot = false |
||
| 10 | service = 'elasticsearch' |
||
| 11 | |||
| 12 | // TODO: These paths should be using the Client class. Otherwise they won't work cross platform. |
||
| 13 | configPath = '/usr/local/etc/elasticsearch/elasticsearch.yml' |
||
| 14 | dataPath = 'path.data' |
||
| 15 | dataRootPath = '/usr/local/var' |
||
| 16 | nginxConfigPath = `${jaleNginxAppsPath}/elasticsearch.conf` |
||
| 17 | |||
| 18 | install = async (): Promise<boolean> => { |
||
| 19 | await client().packageManager.install('homebrew/cask-versions/adoptopenjdk8', true) |
||
| 20 | await client().packageManager.install('libyaml', false) |
||
| 21 | await client().packageManager.install(this.service, false) |
||
| 22 | |||
| 23 | return true |
||
| 24 | } |
||
| 25 | |||
| 26 | configure = async (): Promise<boolean> => { |
||
| 27 | const config = await getConfig() |
||
| 28 | await writeFileSync(this.nginxConfigPath, nginxElasticsearchConf(config.tld)) |
||
| 29 | await (new Nginx).restart() |
||
| 30 | |||
| 31 | return true |
||
| 32 | } |
||
| 36 | export default Elasticsearch |